import request from '@/utils/request'

// 获取商品一级分类
export const getCategory1 = () => {
  return request({
    url: '/admin/product/getCategory1'
  })
}
// 获取商品二级分类
export const getCategory2 = (category1Id) => {
  return request({
    url: `/admin/product/getCategory2/${category1Id}`
  })
}
// 获取商品三级分类
export const getCategory3 = (category2Id) => {
  return request({
    url: `/admin/product/getCategory3/${category2Id}`
  })
}
// 商品基本属性接口
// /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
export const getCategoryList = (category1Id, category2Id, category3Id) => request({ url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}` })

// 添加商品属性
// /admin/product/saveAttrInfo  post
export const saveAttrInfo = (data) => {
  return request({
    url: '/admin/product/saveAttrInfo',
    method: 'post',
    data
  })
}
// 删除属性
export const delAttr = (id) => {
  return request({
    url: `/admin/product/deleteAttr/${id}`,
    method: 'delete'
  })
}
